package com.wenhai.spring.dependency.injection;

import com.wenhai.spring.dependency.injection.annotation.UserGroup;
import com.wenhai.xiaomage.spring.ioc.overview.dependency.domain.User;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ConfigUser {

    @Bean
    @Qualifier
    public User user1() {
        User user = new User();
        user.setId(7L);
        user.setUsername("文海");
        return user;
    }


    @Bean
    @Qualifier
    public User user2() {
        User user = new User();
        user.setId(8L);
        user.setUsername("谢文海");
        return user;
    }
    @Bean
    @UserGroup
    public User user3() {
        User user = new User();
        user.setId(9L);
        user.setUsername("谢文海");
        return user;
    }
    @Bean
    @UserGroup
    public User user4() {
        User user = new User();
        user.setId(10L);
        user.setUsername("谢文海");
        return user;
    }

    public static void main(String[] args) {
        System.out.println(Double.toHexString(21.0000000000000001));
        long xBits = Double.doubleToRawLongBits(1.0000000000000001);
        System.out.println(xBits);
        long yBits = Double.doubleToRawLongBits(1);
        System.out.println(yBits);
        System.out.println(xBits == yBits);
    }
}
